<html>
<head>
<script>
function printReferrer()
{
    var req = new XMLHttpRequest();
    req.open("GET", "callbacks-are-called-in-correct-context.cgi", false);
    req.send(null);
    top.frames[0].document.getElementById("console").innerText += "Referrer: " + req.responseText;
}

function logCallback(callbackType)
{
    top.frames[0].document.getElementById("console").innerText += "FAIL: The " + callbackType + " callback was called in the wrong context.\n"
    printReferrer();
}

function runTestInThirdFrame()
{
    // test that transaction callbacks defined in another frame are executed in the context of that frame
    top.frames[1].db.transaction(top.frames[2].failingTransactionCallback, top.frames[2].errorTransactionCallback);
    top.frames[1].db.transaction(function(tx) { }, null, top.frames[2].successTransactionCallback);
}
</script>
</head>
<body>
</body>
</html>
